<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title>Color Test</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="__STATIC__/plugins/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="__CSS__/v1.css" media="all" />
	</head>

	<body>


	<div style="margin:20px;height:800px;" id="color-wrap">

		<button type="button" class="layui-btn" btn-value="#666666">颜色1</button>
		<button type="button" class="layui-btn layui-btn-primary" btn-value="#ccc">颜色1</button>

		<div style="margin:50px;"><button type="button" class="layui-btn layui-btn-primary" btn-value="#ccc">颜色1</button></div>
		<div style="margin:50px;"><button type="button" class="layui-btn layui-btn-primary" btn-value="#ccc">颜色1</button></div>
		<div style="margin:50px;"><button type="button" class="layui-btn layui-btn-primary" btn-value="#ccc">颜色1</button></div>
		<div style="margin:50px;"><button type="button" class="layui-btn layui-btn-primary" btn-value="#ccc">颜色1</button></div>
		<div style="margin:50px;"><button type="button" class="layui-btn layui-btn-primary" btn-value="#ccc">颜色1</button></div>
		<div style="margin:50px;"><button type="button" class="layui-btn layui-btn-primary" btn-value="#ccc">颜色1</button></div>
		<div style="margin:50px;"><button type="button" class="layui-btn layui-btn-primary" btn-value="#ccc">颜色1</button></div>

	</div>

	<div style="bottom:0;position: fixed;padding:5px 10px;background-color: #fff;height:50px;width:100%;">

		<button type="button" class="layui-btn" id="submit">提交颜色</button>

	</div>
<!-- 	<script type="text/javascript" src="__STATIC__/plugins/layui/layui.js"></script>

<script>

	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引

	//让层自适应iframe
	$('#add').on('click', function(){
	    $('body').append('插入很多酱油。插入很多酱油。插入很多酱油。插入很多酱油。插入很多酱油。插入很多酱油。插入很多酱油。');
	    parent.layer.iframeAuto(index);
	});
	//在父层弹出一个层
	$('#new').on('click', function(){
	    parent.layer.msg('Hi, man', {shade: 0.3})
	});
	//给父页面传值
	$('#transmit').on('click', function(){
	    parent.$('#parentIframe').text('我被改变了');
	    parent.layer.tips('Look here', '#parentIframe', {time: 5000});
	    parent.layer.close(index);
	});
	//关闭iframe
	$('#closeIframe').click(function(){
	    var val = $('#name').val();
	    if(val === ''){
	        parent.layer.msg('请填写标记');
	        return;
	    }
	    parent.layer.msg('您将标记 [ ' +val + ' ] 成功传送给了父窗口');
	    parent.layer.close(index);
	});

//var index = parent.layer.getFrameIndex(window.name);
//parent.layer.iframeAuto(index);
</script> -->

	<script type="text/javascript">
		var index = parent.layer.getFrameIndex(window.name),
		layui = parent.layui,
		SYS	= parent.SYS,
		CONFIG = parent.CONFIG,
		BIN = parent.BIN,
		CHILD = {};
		
		layui.use(['form','jquery','layer'],function(){

			var $ = layui.jquery,
				layer = layui.layer,
				index = parent.layer.getFrameIndex(window.name);

			var child = $(layer.getChildFrame('body',index));
		
			child.find('button').click(function(){

				CHILD.c_value = 'test';

				console.log(CHILD);

				var values = $(this).attr('btn-value');

				console.log(parent.BIN.color_dom);

				//更改测试
				$(BIN.color_dom).val(values);



			});

			//页面关闭
			//parent.layer.close(index);

		});
	</script>
</body>
</html>
